/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.Entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author KIS
 */
@Entity
@Table(name = "complaint", catalog = "Final_Project_Sem_IV", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Complaint.findAll", query = "SELECT c FROM Complaint c"),
    @NamedQuery(name = "Complaint.findById", query = "SELECT c FROM Complaint c WHERE c.id = :id"),
    @NamedQuery(name = "Complaint.findByLodgingDate", query = "SELECT c FROM Complaint c WHERE c.lodgingDate = :lodgingDate"),
    @NamedQuery(name = "Complaint.findByClosingDate", query = "SELECT c FROM Complaint c WHERE c.closingDate = :closingDate"),
    @NamedQuery(name = "Complaint.findByStatus", query = "SELECT c FROM Complaint c WHERE c.status = :status"),
    @NamedQuery(name = "Complaint.findByDescription", query = "SELECT c FROM Complaint c WHERE c.description = :description"),
    @NamedQuery(name = "Complaint.findByPriority", query = "SELECT c FROM Complaint c WHERE c.priority = :priority")})
public class Complaint implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "lodgingDate", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date lodgingDate;
    @Column(name = "closingDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date closingDate;
    @Column(name = "status")
    private Integer status;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 300)
    @Column(name = "description", nullable = false, length = 300)
    private String description;
    @Lob
    @Size(max = 2147483647)
    @Column(name = "solution", length = 2147483647)
    private String solution;
    @Column(name = "priority")
    private Integer priority;
    @JoinColumn(name = "complaintCategoryID", referencedColumnName = "id")
    @ManyToOne
    private ComplaintCategory complaintCategoryID;
    @JoinColumn(name = "solvingTechnicianID", referencedColumnName = "id")
    @ManyToOne
    private CompanyUser solvingTechnicianID;
    @JoinColumn(name = "lodgingEmployeeID", referencedColumnName = "id")
    @ManyToOne
    private CompanyUser lodgingEmployeeID;

    public Complaint() {
    }

    public Complaint(Integer id) {
        this.id = id;
    }

    public Complaint(Integer id, Date lodgingDate, String description) {
        this.id = id;
        this.lodgingDate = lodgingDate;
        this.description = description;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getLodgingDate() {
        return lodgingDate;
    }

    public void setLodgingDate(Date lodgingDate) {
        this.lodgingDate = lodgingDate;
    }

    public Date getClosingDate() {
        return closingDate;
    }

    public void setClosingDate(Date closingDate) {
        this.closingDate = closingDate;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getSolution() {
        return solution;
    }

    public void setSolution(String solution) {
        this.solution = solution;
    }

    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    public ComplaintCategory getComplaintCategoryID() {
        return complaintCategoryID;
    }

    public void setComplaintCategoryID(ComplaintCategory complaintCategoryID) {
        this.complaintCategoryID = complaintCategoryID;
    }

    public CompanyUser getSolvingTechnicianID() {
        return solvingTechnicianID;
    }

    public void setSolvingTechnicianID(CompanyUser solvingTechnicianID) {
        this.solvingTechnicianID = solvingTechnicianID;
    }

    public CompanyUser getLodgingEmployeeID() {
        return lodgingEmployeeID;
    }

    public void setLodgingEmployeeID(CompanyUser lodgingEmployeeID) {
        this.lodgingEmployeeID = lodgingEmployeeID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Complaint)) {
            return false;
        }
        Complaint other = (Complaint) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.Entity.Complaint[ id=" + id + " ]";
    }
    
}
